<@cms.categoryList advanced=true parentId=categoryId allowContribute=allowContribute pageIndex=pageNum pageSize=numPerPage>
<@sys.authorized roleIds=admin.roles urls='cmsCategory/add,cmsCategory/delete,cmsCategory/publish,cmsCategory/rebuildChildIds,cmsCategory/batchPublish,cmsCategory/export,cmsCategory/import,cmsCategory/contributeForm,cmsCategory/static,cmsCategory/moveParameters,cmsCategory/changeTypeParameters,cmsCategory/publishParameters,cmsPlace/push'><#assign authorizedMap=map/></@sys.authorized>
<div class="pageHeader card">
    <form autocomplete="off" class="pagerForm" action="common/category_list.html" onsubmit="return divSearch(this,'categoryBox');" method="post">
        <#include "../include_page/parameters.html"/>
        <input name="categoryId" type="hidden" value="${categoryId!}"/>
        <div class="searchBar">
            <ul class="searchContent">
                <li>
                    <select class="combox" name="allowContribute">
                        <option value><@t.page 'contribute'/></option>
                        <option value="true"${(allowContribute?has_content&&"true"==allowContribute)?then(' selected="true"','')?no_esc}><@t.page 'allow_contribute'/></option>
                        <option value="false"${(allowContribute?has_content&&"false"==allowContribute)?then(' selected="true"','')?no_esc}><@t.page 'forbid_contribute'/></option>
                    </select>
                </li>
            </ul>
            <div class="subBar">
                <ul>
                    <li>
                        <button type="submit" class="buttonActive"><@t.page 'button.search'/></button>
                    </li>
                    <#if authorizedMap['cmsCategory/export']>
                        <li>
                            <a class="button" href="cmsCategory/export?_csrf=<@tools.csrfToken admin=true/>" target="dwzExport" targetType="navTab"><i class="icon-download-alt icon-large"></i><@t.page 'button.export'/></a>
                        </li>
                    </#if>
                </ul>
            </div>
        </div>
    </form>
</div>
<div class="card">
    <div class="panelBar">
        <ul class="toolBar">
<#if authorizedMap['cmsCategory/add']>
            <li>
                <a href="cmsCategory/add.html?parentId=${categoryId!}" class="addMore" target="navTab" rel="cmsCategory/add"><i class="icon-plus icon-large"></i><@t.page 'category.add'/></a>
                <ul>
    <@cms.categoryTypeList pageSize=10>
        <#list page.list as a>
            <li><a href="cmsCategory/add.html?parentId=${categoryId!}&typeId=${a.id}" target="navTab" rel="cmsCategory/add"><i class="icon-plus icon-large"></i><@t.page 'button.add_some_things' a.name/></a></li>
        </#list>
        <#if page.totalCount gt 10>
            <li><a href="cmsCategory/addMore.html?parentId=${categoryId!}" target="dialog" mask="true"><i class="icon-plus icon-large"></i><@t.page 'category.add_more'/></a></li>
        </#if>
    </@cms.categoryTypeList>
                </ul>
            </li>
            <li class="line">line</li>
</#if>
        <#if authorizedMap['cmsCategory/publish']>
            <li><a href="cmsCategory/publish?_csrf=<@tools.csrfToken admin=true/>" title="<@t.page 'confirm.batch_publish'/>" target="selectedTodo" rel="ids"><i class="icon-file-text-alt icon-large"></i><@t.page 'button.batch_publish'/></a></li>
        </#if>
        <#if authorizedMap['cmsCategory/moveParameters']>
            <li><a href="cmsCategory/moveParameters.html" target="dialog" mask="true"><i class="icon-move icon-large"></i><@t.page 'button.batch_move'/></a></li>
        </#if>
        <#if authorizedMap['cmsCategory/batchPublish']>
            <li><a href="cmsCategory/batchPublish?_csrf=<@tools.csrfToken admin=true/>" title="<@t.page 'confirm.do'/>" target="selectedTodo" rel="ids"><i class="icon-file-text-alt icon-large"></i><@t.page 'button.batch_publish_content'/></a></li>
        </#if>
        <#if authorizedMap['cmsCategory/delete']>
            <li class="line">line</li>
            <li><a href="cmsCategory/delete?_csrf=<@tools.csrfToken admin=true/>&ref=page" title="<@t.page 'confirm.batch_delete'/>" target="selectedTodo" rel="ids"><i class="icon-trash icon-large"></i><@t.page 'button.batch_delete'/></a></li>
        </#if>
        <#if authorizedMap['cmsCategory/rebuildChildIds']>
            <li class="line">line</li>
            <li><a href="cmsCategory/rebuildChildIds?_csrf=<@tools.csrfToken admin=true/>&ref=page" title="<@t.page 'confirm.do'/>" target="ajaxTodo"><i class="icon-refresh icon-large"></i><@t.page 'button.rebuild_childs'/></a></li>
        </#if>
        <#if authorizedMap['cmsCategory/import']>
            <li><a href="cmsCategory/import.html" target="dialog" mask="true" width="500" height="250"><i class="icon-upload-alt icon-large"></i><@t.page 'import'/></a></li>
        </#if>
        </ul>
    </div>
    <table class="table" width="100%" layoutH targetType="ajax" rel="categoryBox">
        <thead>
            <tr>
                <th width="20"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
                <th width="30"><@t.page 'id'/></th>
                <th><@t.page 'name'/></th>
                <th><@t.page 'code'/></th>
                <th><@t.page 'category_type'/></th>
                <th><@t.page 'category.parent'/></th>
                <th><@t.page 'category.page_size'/></th>
                <th><@t.page 'contribute'/></th>
                <th><@t.page 'display'/></th>
                <th><@t.page 'sort'/></th>
                <th><@t.page 'operate'/></th>
            </tr>
        </thead>
        <tbody>
            <#list page.list as a>
                <@t.merge 'parentIds' a.parentId!/>
                <@t.merge 'typeIds' a.typeId!/>
                <@t.merge 'ids' a.id/>
            </#list>
            <@sys.lock userId=admin.id itemType='category' itemIds=t.ids><#assign lockMap=map!/></@sys.lock>
            <#if lockMap?has_content>
                <#list lockMap as k,lock>
                    <#if lock.userId?has_content><@t.merge 'userIds' lock.userId/></#if>
                </#list>
            </#if>
            <@sys.user ids=t.userIds><#assign userMap=map!/></@sys.user>
            <@cms.category ids=t.parentIds!><#assign parentMap=map!/></@cms.category>
            <@cms.categoryType ids=t.typeIds!><#assign typeMap=map!/></@cms.categoryType>
            <#list page.list as a>
            <tr>
                <td><input name="ids" value="${a.id}" type="checkbox"></td>
                <td>${a.id!}</td>
                <td <#if lockMap[a.id?string]?has_content><#assign lockUser=(userMap[lockMap[a.id?string].userId?string].nickname)!''/>title="<@t.page 'lock.message' lockUser/> ${lockMap[a.id?string].createDate}"</#if>>
                    <#if lockMap[a.id?string]?has_content><i class="icon-lock icon-large"></i></#if>
                    <a class="exclude-translate" href="cmsDiy/preview.html?url=${((a.url)?url)!}" target="navTab" rel="cmsDiy/preview"  icon="<i class='bi bi-palette2 icon-large'></i>" title="<@t.page 'diy.preview'/>">${(a.name)!}</a>
                    <a href="${a.url!}" target="_blank"><i class="icon-external-link"></i></a>
                    ${(a.onlyUrl?then('['+t.pageMessage('url')+']',''))!}
                </td>
                <td class="exclude-translate">${a.code!}</td>
                <td class="exclude-translate">${(typeMap[a.typeId?string].name)!}</td>
                <td class="exclude-translate">${(parentMap[a.parentId?string].name)!}</td>
                <td><#if !a.onlyUrl>${a.pageSize!}${(a.containChild?then('['+t.pageMessage('category.contain_child')+']',''))!}</#if></td>
                <td>
                    <#if a.allowContribute>
                        <#if authorizedMap['cmsCategory/contributeForm']>
                    <a href="cmsCategory/contributeForm.html?categoryId=${a.id}" target="dialog" mask="true" title="<@t.page 'help.contribute_form'/>"><@t.page 'allow_contribute'/></a>
                        <#else>
                    <@t.page 'allow_contribute'/>
                        </#if>
                    </#if>
                </td>
                <td>${a.hidden?then(t.pageMessage('hidden'),t.pageMessage('show'))}</td>
                <td>${a.sort!}</td>
                <td class="wrap">
                <#if authorizedMap['cmsCategory/add']>
                    <a href="cmsCategory/add.html?id=${a.id}" class="edit btnText blue" target="navTab" rel="cmsCategory/edit"><i class="icon-edit"></i><@t.page 'category.edit'/></a>
                    <a href="cmsCategory/addMore.html?parentId=${a.id}" class="btnText blue" target="dialog" mask="true"><i class="icon-plus"></i><@t.page 'category.add_child'/></a>
                    <a href="cmsCategory/add.html?copyId=${a.id}" class="btnText blue" target="navTab" rel="cmsCategory/add" icon="<i class='icon-plus-sign-alt'></i>" title="<@t.page 'category.add'/>"><i class="icon-copy"></i><@t.page 'button.copy'/></a>
                </#if>
                <#if authorizedMap['cmsCategory/changeTypeParameters']>
                    <a href="cmsCategory/changeTypeParameters.html?id=${a.id}" class="btnText blue" target="dialog" mask="true"><@t.page 'category.change_type'/></a>
                </#if>
                <#if authorizedMap['cmsCategory/export']>
                    <a href="cmsCategory/export?id=${a.id}&_csrf=<@tools.csrfToken admin=true/>" class="btnText" target="_blank"><i class="icon-download-alt icon-large"></i><@t.page 'button.export'/></a>
                </#if>
                <#if authorizedMap['cmsPlace/push']>
                    <a href="cmsPlace/push.html?itemType=category&itemId=${a.id}" class="btnText blue" target="dialog" mask="true"><@t.page 'button.push'/></a>
                </#if>
                <#if authorizedMap['cmsCategory/publishParameters']&&site.useStatic&&!a.onlyUrl>
                    <a href="cmsCategory/publishParameters.html?id=${a.id}&pageSize=${a.pageSize}&containChild=${a.containChild?then('true','false')}" class="btnText blue" target="dialog" width="450" height="180" mask="true"><@t.page 'button.publish'/></a>
                </#if>
                </td>
            </tr>
            </#list>
        </tbody>
    </table>
    <#assign rel='categoryBox'/>
    <#include "../include_page/page.html"/>
</div>
</@cms.categoryList>